home *** CD-ROM | disk | FTP | other *** search
/ Amiga Tools 3 / Amiga Tools 3.iso / grafik / raytracing / rayshade-4.0.6.3 / rayshade / main.c next >
Encoding:
C/C++ Source or Header  |  1994-08-09  |  2.9 KB  |  135 lines

  1. /*
  2.  * main.c
  3.  *
  4.  * Copyright (C) 1989, 1991, Craig E. Kolb
  5.  * All rights reserved.
  6.  *
  7.  * This software may be freely copied, modified, and redistributed
  8.  * provided that this copyright notice is preserved on all copies.
  9.  *
  10.  * You may not distribute this software, in whole or in part, as part of
  11.  * any commercial product without the express consent of the authors.
  12.  *
  13.  * There is no warranty or other guarantee of fitness of this software
  14.  * for any purpose.  It is provided solely "as is".
  15.  *
  16.  * main.c,v 4.1 1994/08/09 08:07:05 explorer Exp
  17.  *
  18.  * main.c,v
  19.  * Revision 4.1  1994/08/09  08:07:05  explorer
  20.  * Bump version to 4.1
  21.  *
  22.  * Revision 1.2  1994/08/09  06:44:25  explorer
  23.  * Altered the way version numbers are maintained and printed.
  24.  *
  25.  * Revision 1.1.1.1  1994/08/08  04:52:28  explorer
  26.  * Initial import.  This is a prerelease of 4.0.6enh3, or 4.1 possibly.
  27.  *
  28.  * Revision 4.0  91/07/17  14:50:39  kolb
  29.  * Initial version.
  30.  * 
  31.  */
  32.  
  33. char rcsid_main_c[] = 
  34.     "main.c,v 4.1 1994/08/09 08:07:05 explorer Exp";
  35.  
  36. #include "rayshade.h"
  37. #include "options.h"
  38. #include "stats.h"
  39. #include "viewing.h"
  40. #include "picture.h"
  41.  
  42. #ifdef AMIGA
  43. #ifndef __GNUC__
  44. long InitTime[2];
  45. #endif
  46. #endif
  47.  
  48. int
  49. #ifdef LINDA
  50. rayshade_main(argc, argv)
  51. #else
  52. main(argc, argv)
  53. #endif
  54. int argc;
  55. char **argv;
  56. {
  57.     Float utime, stime, lasttime;
  58.     int i;
  59.     extern Geom *World;
  60.  
  61. #ifdef AMIGA
  62. #ifndef __GNUC__
  63.     timer(InitTime);
  64. #endif
  65.     ReducePriority();
  66. #endif
  67. #ifdef LINDA
  68.     Options.workernum = 0;    /* we're the supervisor */
  69. #endif
  70.  
  71.     RSInitialize(argc, argv);
  72.  
  73.  
  74.     /*
  75.      * Start the first frame.
  76.      */
  77.     RSStartFrame(Options.startframe);
  78.     /*
  79.       * Print more information than we'll ever need to know...
  80.      */
  81.     if (Options.verbose) {
  82.         /* World object info. */
  83.         AggregatePrintInfo(World, Stats.fstats);
  84.         /* Print info about rendering options and the like. */
  85.         RSOptionsList();
  86.     }
  87.     /*
  88.      * Start new picture.
  89.      */
  90.     PictureStart(argv);
  91.     /*
  92.      * Print preprocessing time.
  93.      */
  94.     RSGetCpuTime(&utime, &stime);
  95.     fprintf(Stats.fstats,"Preprocessing time:\t");
  96.     fprintf(Stats.fstats,"%2.2fu  %2.2fs\n", utime, stime);
  97.     fprintf(Stats.fstats,"Starting trace.\n");
  98.     (void)fflush(Stats.fstats);
  99.     lasttime = utime+stime;
  100.     /*
  101.      * Render the first frame
  102.      */
  103.     raytrace(argc, argv);
  104.     /*
  105.      * Render the remaining frames.
  106.      */
  107.     for (i = Options.startframe +1; i <= Options.endframe ; i++) {
  108.         PictureFrameEnd();    /* End the previous frame */
  109.         RSGetCpuTime(&utime, &stime);
  110.         fprintf(Stats.fstats, "Total CPU time for frame %d: %2.2f \n", 
  111.             i - 1, utime+stime - lasttime);
  112.         PrintMemoryStats(Stats.fstats);
  113.         (void)fflush(Stats.fstats);
  114.         lasttime = utime+stime;
  115.         RSStartFrame(i);
  116.         if (Options.verbose) {
  117.             AggregatePrintInfo(World, Stats.fstats);
  118.             (void)fflush(Stats.fstats);
  119.         }
  120.         PictureStart(argv);
  121.         raytrace(argc, argv);
  122.     }
  123.     /*
  124.      * Close the image file.
  125.      */
  126.     PictureFrameEnd();    /* End the last frame */
  127.     PictureEnd();
  128.     StatsPrint();
  129. #ifdef AMIGA
  130.     exit(0);
  131. #else
  132.     return 0;
  133. #endif
  134. }
  135.